public class Assign extends Quaternion {
    private Pairs pairs;
    private Pairs address;
    private Pairs answer;
    private Pairs address2;

    public Assign(Pairs pairs, Pairs address, Pairs answer) {
        super(OP.ASSIGN);
        this.answer = answer;
        this.address = address;
        this.pairs = pairs;
    }

    public Assign(Pairs pairs, Pairs address, Pairs answer,Pairs address2) {
        super(OP.ASSIGN);
        this.answer = answer;
        this.address = address;
        this.pairs = pairs;
        this.address2 = address2;
    }

    public Assign(Pairs pairs, Pairs address, Pairs answer,Pairs address2,OP op) {
        super(op);
        this.answer = answer;
        this.address = address;
        this.pairs = pairs;
        this.address2 = address2;
    }
    
    public Assign(Pairs pairs, Pairs address, Pairs answer, OP op) {
        super(op);
        this.answer = answer;
        this.address = address;
        this.pairs = pairs;
    }

    public Pairs getAnswer() {
        return this.answer;
    }

    public Pairs getPairs() {
        return this.pairs;
    }

    public Pairs getAddress() {
        return this.address;
    }

    public Pairs getAddress2() {
        return this.address2;
    }

    public String toString() {
        if (getOp().equals(OP.ARRAY)) {
            if (address == null) {
                if (address2 != null) {
                    return pairs.getToken() + " " + "=" + " " + answer.getToken() + "[" + address2.getToken() + "]" + "\n";
                }
                return pairs.getToken() + " " + "=" + " " + answer.getToken() + "\n";
            } else {
                if (address2 != null) {
                    return pairs.getToken() + "[" + address.getToken() + "]" + " " + "=" + " " + answer.getToken() + "[" + address2.getToken() + "]" + "\n";
                }
                return pairs.getToken() + "[" + address.getToken() + "]" + " " + "=" + " " + answer.getToken() + "\n";
            }
        } else {
            if (address == null) {
                if (getOp().equals(OP.GETINT)) {
                    return pairs.getToken() + " " + "=" + " " + opToString() + "\n";
                }
                if (address2 != null) {
                    return pairs.getToken() + " " + opToString() + " " + answer.getToken() + "[" + address2.getToken() + "]" + "\n";
                }
                return pairs.getToken() + " " + opToString() + " " + answer.getToken() + "\n";
            } else {
                if (address2 != null) {
                    return pairs.getToken() + "[" + address.getToken() + "]" + " " + opToString() + " " + answer.getToken() + "[" + address2.getToken() + "]" + "\n";
                }
                return pairs.getToken() + "[" + address.getToken() + "]" + " " + opToString() + " " + answer.getToken() + "\n";
            }
        }
    }
}
